#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
void spin(int *nums,int begin,int end)
{
	while (begin < end)
	{
		int a = nums[begin];
		nums[begin] = nums[end];
		nums[end] = a;
		begin++;
		end--;
	}
}

int main()
{
	int arr[] = { 1,2,3,4,5,6,7 };
	int sz = sizeof(arr) / sizeof(arr[0]);
	int n = 0;
	scanf("%d", &n);
	spin(arr,0,sz-n-1);
	spin(arr, sz-n,sz-1);
	spin(arr, 0, sz -1);

	return 0;
}